<?php
session_start()
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <META content="sweets 011" name="Microsoft Theme" />	
        <title>Tóc đẹp Dung Nhi | Chuyên làm đẹp cho tóc nữ</title>
        <meta name="keywords" content="tocdepdungnhi, tocdepdungnhi.vn, toc dep dung nhi, tóc đẹp dung nhi, dung nhi, dungnhi, hair, hairsalon, hair salon, dung nhi salon, salon toc, salon toc dung nhi, toc dung nhi, salon toc, dich vu toc, toc dep, lam dep toc, tóc, dịch vụ tóc, làm đẹp, làm đẹp tóc, lam dep, lamdep" />
        <meta name="description" content="Tóc đẹp Dung Nhi | Salon chuyên làm đẹp cho tóc nữ, với kinh nghiệm làm hơn 10 năm trong nghề, đem lại mái tóc mềm mượt và đẹp đủ để khiến bạn phải hài lòng.Tiết kiệm thời gian và tiền bạc. Mrs Dương | SĐT: 0946260620" /> 
        <meta name="robots" content="index, follow" />
        <link rel="shortcut icon" href="img/favicon.ico" />
        <link rel="stylesheet" type="text/css" href="css/reset.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />      
        <script>
            (function(i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r;
                i[r] = i[r] || function() {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
                a = s.createElement(o),
                        m = s.getElementsByTagName(o)[0];
                a.async = 1;
                a.src = g;
                m.parentNode.insertBefore(a, m)
            })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

            ga('create', 'UA-47040096-1', 'tocdepdungnhi.vn');
            ga('send', 'pageview');

        </script>
        <META content="MSHTML 6.00.2900.3086" name=GENERATOR></HEAD>
    <script language="javascript">
        function Focus() {
            document.f.ten_dang_nhap.focus();
        }
    </script>
</head>
<BODY onLoad="return Focus();">
    <?php
    include_once('../../common/function.php');
    $nameCompany = getCompanyName();

    if ($_POST['Login']) {
        global $db;
        include_once('../../common/init2.php');

        include_once(DIR_LANG_MUDUL . "admin.php");
        include_once(DIR_MODEL . "md_admin.class.php");
        $objModel = new MD_Admin($db);
        $ten_dang_nhap = CM_getParameter("ten_dang_nhap");
        $mat_khau = md5(CM_getParameter("mat_khau"));
        $_SESSION["Pkd_ten_dang_nhap_sai"] = $ten_dang_nhap;
        $_SESSION["Pkd_mat_khau_sai"] = $mat_khau;
        $arrayData = $objModel->getByWhere("*", "username='" . $ten_dang_nhap . "' and password='" . $mat_khau . "'");
        if (count($arrayData) != 0) {
            $row = $arrayData[0];

            $_SESSION["Pkd_id"] = $row["id"];
            $_SESSION["Pkd_ten"] = $row["fullname"];
            $_SESSION["Pkd_ten_dang_nhap"] = $ten_dang_nhap;
            $_SESSION["Pkd_mat_khau"] = $mat_khau;

            session_register('ssLogin_Pkd');
            $id = $row["id"];
            if ($objModel->errno()) {
                $arrayError[] = $objModel->error();
            }
            unset($arrayData);
            CM_gotoPage("main.php");
        } else {
            CM_gotoPage("login.php?err=1");
        }
    }
    ?>
    <FORM  action="" method="post" name="f">  
        <table align="center" border="0" width="389" cellspacing="0" cellpadding="0">
            <tr>
                <td width="44">
                    <img src="../img_login/Login_03.gif" border="0"></td>
                <td background="../img_login/login_06.gif" valign="top">
                    <table class="font" border="0" width="100%" id="table2" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="13%" valign="top">
                                <img src="../img_login/login_07.gif">
                            </td>
                            <td valign="top">&nbsp;</td>
                            <td width="13%" valign="top">
                                <img src="../img_login/login_07.gif">
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" valign="top" style="text-align:center; ">
                                <font  style="font-size:18px; text-transform:uppercase;" color="#FFFFFF"><strong>ĐĂNG NHẬP QUẢN TRỊ WEBSITE <?= $nameCompany ?></strong></font><br>
                                <p align="right">&nbsp;</p>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" valign="top">
                                <table class="font" border="0" width="100%" id="table3" cellpadding="3" cellspacing="0">
                                    <tr>
                                        <td align="right" width="37%"><strong>Tên</strong></td>
                                        <td>
                                            <input class="txtbox" type="text" id="ten_dang_nhap" name="ten_dang_nhap" style="width:180px; " 
                                                   value="<?= $_SESSION["Pkd_ten_dang_nhap_sai"] ?>">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right"><strong>Mật khẩu</strong></td>
                                        <td>
                                            <input class="txtbox" id="mat_khau" type="password" name="mat_khau" style="width:180px; ">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" height="5"></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" align="center" style="padding-left:93px; ">
                                            <input class="button" type="submit" name="Login" value=" Đăng nhập "> 
                                            <input class="button" type="reset" name="reset" value=" Nhập lại "></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2" height="10"></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="37">
                    <img src="../img_login/login_08.gif" border="0"></td>
            </tr>
        </table>
    </FORM>
</body>
</html>
